 <!-- 我发布过的信息 -->
<template>
  <div class="addJoblist">
    <h3 class="title">我发布过的信息</h3>
    <el-table :data="list" stripe style="width: 100%; margin: 30px 0 30px 0">
      <el-table-column label="发布时间" prop="createTime"> </el-table-column>
      <el-table-column label="企业名称" prop="companyName"> </el-table-column>
      <el-table-column label="在招岗位" prop="post"> </el-table-column>
      <el-table-column label="任职要求" prop="jobRequirements">
      </el-table-column>
      <el-table-column label="岗位职责" prop="positionStatement">
      </el-table-column>
      <el-table-column label="工作经验" prop="workYear"> </el-table-column>
      <el-table-column label="学历要求" prop="education"> </el-table-column>
      <el-table-column label="福利待遇" prop="socialBenefits">
      </el-table-column>
      <el-table-column label="工作地点" prop="workPlace"> </el-table-column>
      <el-table-column label="提供薪资" prop="pay"> </el-table-column>
      <el-table-column align="right">
        <template slot-scope="scope">
          <el-button size="mini" type="danger" @click="handleDelete(scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import addJobList from "../request/index";
export default {
  data() {
    return {
      list: [],
    };
  },
  methods: {
    // 删除
    handleDelete(row) {
      this.$confirm("确定删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          //删除请求
          addJobList.deletejobList(row.id).then((res) => {
            if (res.data.code == 200) {
              this.$message.success("删除成功");
              //删除成功 回调列表接口
              this.getaddJobList();
            }
          });
        })
        .catch(() => {});
    },

    // 获取招聘信息列表
    getaddJobList() {
      //添加请求
      addJobList.addjobList({}).then((res) => {
        this.list = res.data.result;
        this.list = this.list.map((item) => {
          item.createTime = item.createTime.slice(0, 10);
          return item;
        });
        console.log(this.list);
      });
    },
  },
  //初始化页面方法
  created() {
    //获取招聘信息列表
    this.getaddJobList();
  },
};
</script>

<style lang="scss" scoped >
* {
  padding: 0;
  margin: 0;
}
.addJoblist {
  ::v-deep .title {
    text-align: center;
    font-size: 20px;
  }
  ::v-deep .el-button {
    height: 25px;
    width: 40px;
  }
}
</style>
